# encoding: utf-8

import os
from typing import List, Tuple


def load_txt(file_name: str, encoding: str = "utf-8") -> List[str]:
    if not os.path.exists(file_name):
        raise Exception(f"file {file_name} not found")

    with open(file_name, "r", encoding=encoding) as f:
        lines = f.readlines()
    return lines


def split_text(lines: List[str], split: str = "__", num: int = 2) -> Tuple[List[str], List[str]]:
    list1 = []
    list2 = []

    for line in lines:
        l1, l2 = line.strip().split(split)
        list1.append(l1)
        list2.append(l2)
    return list1, list2
